<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="utf-8">
    <title>LeanCloud</title>
    <link href="https://dn-avoscloud.qbox.me/statics/bootstrap.min.css" rel="stylesheet">

    <style>
    h3 {
      text-align: center;
      margin-top: 50px;
      font-weight: normal;
    }
    </style>
  </head>
  <body>

<div class=" container">
   <h3 id="tip" style="display:none"></h3>
   <!-- <h3 id="tip">Test</h3> -->



</div><!--end container-->
<script src="https://dn-avoscloud.qbox.me/statics/jquery.min.js"></script>
<script src="https://dn-avoscloud.qbox.me/statics/jquery.jsonp.js"></script>

<script type="text/javascript">
  var url = "/1/verifyEmail/";//如果页面运行在自己的服务器，需要写定一个绝对 URL,类似 "https://api.leancloud.cn/1.1/verifyEmail/"
  var tip_err ="邮箱验证出错"; //邮箱验证出错提示
  var tip_success ="邮箱验证成功";//邮箱验证成功提示
  function getParam() {
    var prmstr = window.location.search.substr(1);
    var prmarr = prmstr.split("&");
    var params = {};

    for (var i = 0; i < prmarr.length; i++) {
      var tmparr = prmarr[i].split("=");
      params[tmparr[0]] = tmparr[1];
    }
    return params;
  }

  //获得token,以验证邮件合法性
  var token = location.search.match(/token=(\w*)/);
  if(token&&token[1]){
    token = token[1];
  }
  function verify(){
    if(!token){
      return;
    }
    $.jsonp({
        url:url+token,
        callbackParameter: "callback",
        cache: false,
        success:function(result){
          $("#tip").show();
          if(result.error){
            $("#tip").text(result.error);
          }else{
            $("#tip").html(tip_success);
          }
        },
        error:function(result,text){
          $("#tip").text("服务器发生错误");
        }
      });
  }

  $(function(){
    verify();
  })

</script>

  </body>
  </html>